﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace YXShop.TemplateAction
{
    public partial class LabelParse
    {
        public string CreateURL()
        {
            string reStr = string.Empty;
            string mystyle = this.Label_Inserted;
            string FileName = this.GetParamValue("YX:FileName");//文件名
            string URLParameter = this.GetParamValue("YX:URLParameter");//URL参数
            string FilePath = this.GetParamValue("YX:FilePath");//文件路径
            string Target = this.GetParamValue("YX:Target");//打开方式
            string Url = Common.UrlStr(FileName, URLParameter, FilePath);
            if (URLParameter == "URLParameter")
            {
                string Query = HttpContext.Current.Request.Url.Query;
                if (!string.IsNullOrEmpty(Query))
                {
                    URLParameter = Query.Replace("&", ";").Replace("?", "");
                }
                else
                {
                    URLParameter = "";
                }
                Url = Common.UrlStr(FileName, URLParameter, FilePath);
            }
            if (!string.IsNullOrEmpty(mystyle))
            {
                if (!string.IsNullOrEmpty(Target))
                {
                    reStr = "<a href='" + Url + "' Target='" + Target + "'>" + mystyle + "</a>";
                }
                else
                {
                    reStr = "<a href=" + Url + ">" + mystyle + "</a>";
                }
            }
            else
            {
                reStr = Url;
            }

            return reStr;
        }
    }
}
